package edu.unmsm.ocaa.sisocaa.negocio.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.dao.DataAccessException;
import org.springframework.stereotype.Service;

import edu.unmsm.ocaa.sisocaa.integracion.dao.EncuestDocDAO;
import edu.unmsm.ocaa.sisocaa.negocio.model.dto.ControlPreguntasDTO;
import edu.unmsm.ocaa.sisocaa.negocio.model.dto.EncuestDocDTO;
import edu.unmsm.ocaa.sisocaa.negocio.service.EncuestDocService;

@Service
public class EncuestDocServiceImpl implements EncuestDocService {

	@Resource
	EncuestDocDAO encdao;
	

	public void ingresarEncuesta(EncuestDocDTO enc, ControlPreguntasDTO ctrlpreg) throws DataAccessException {
		// TODO Auto-generated method stub
		Boolean correcto=new Boolean(false);
		correcto=revisionPreguntas(ctrlpreg, enc);
		if (correcto)
		encdao.insertEncuestDoc(enc);
		
	}

	public Boolean revisionPreguntas(ControlPreguntasDTO ctrlpreg,EncuestDocDTO enc)throws DataAccessException {
		// TODO Auto-generated method stub
		Boolean correcto=new Boolean(true);
		if(!ctrlpreg.getShow1())
		{	correcto=ctrlpreg.getShow1();}
		else if(!ctrlpreg.getShow2())
		{	correcto=ctrlpreg.getShow2();}
		else if(!ctrlpreg.getShow3())
		{	correcto=ctrlpreg.getShow3();}
		else if(!ctrlpreg.getShow4())
		{	correcto=ctrlpreg.getShow4();}
		else if(!ctrlpreg.getShow4())
		{	correcto=ctrlpreg.getShow4();}
		else if(!ctrlpreg.getShow5())
		{	correcto=ctrlpreg.getShow5();}
		else if(!ctrlpreg.getShow5())
		{	correcto=ctrlpreg.getShow5();}
		else if(!ctrlpreg.getShow6())
		{	correcto=ctrlpreg.getShow6();}
		else if(!ctrlpreg.getShow7())
		{	correcto=ctrlpreg.getShow7();}
		else if(!ctrlpreg.getShow8())
		{	correcto=ctrlpreg.getShow8();}
		else if(!ctrlpreg.getShow9())
		{	correcto=ctrlpreg.getShow9();}
		else if(!ctrlpreg.getShow10())
		{	correcto=ctrlpreg.getShow10();}
		else if(!ctrlpreg.getShow11())
		{	correcto=ctrlpreg.getShow11();}
		else if(!ctrlpreg.getShow12())
		{	correcto=ctrlpreg.getShow12();}
		else if(!ctrlpreg.getShow13())
		{	correcto=ctrlpreg.getShow13();}
		else if(!ctrlpreg.getShow14())
		{	correcto=ctrlpreg.getShow14();}
		else if(!ctrlpreg.getShow15())
		{	correcto=ctrlpreg.getShow15();}
		else if(!ctrlpreg.getShow16())
		{	correcto=ctrlpreg.getShow16();}
		else if(!ctrlpreg.getShow17())
		{	correcto=ctrlpreg.getShow17();}
		else if(!ctrlpreg.getShow18())
		{	correcto=ctrlpreg.getShow18();}
		else if(!ctrlpreg.getShow19())
		{	correcto=ctrlpreg.getShow19();}
		else if(!ctrlpreg.getShow20())
		{	correcto=ctrlpreg.getShow20();}
		else if(!ctrlpreg.getShow21())
		{	correcto=ctrlpreg.getShow21();}
		else if(!ctrlpreg.getShow22())
		{	correcto=ctrlpreg.getShow22();}
		else if(!ctrlpreg.getShow23())
		{	correcto=ctrlpreg.getShow23();}
		else if(!ctrlpreg.getShow24())
		{	correcto=ctrlpreg.getShow24();}
		else if(!ctrlpreg.getShow25())
		{	correcto=ctrlpreg.getShow25();}
		else if(!ctrlpreg.getShow26())
		{	correcto=ctrlpreg.getShow26();}
		else if(!ctrlpreg.getShow27())
		{	correcto=ctrlpreg.getShow27();}
		else if(!ctrlpreg.getShow28())
		{	correcto=ctrlpreg.getShow28();}
		else if(!ctrlpreg.getShow29())
		{	correcto=ctrlpreg.getShow29();}
		else if(!ctrlpreg.getShow30())
		{	correcto=ctrlpreg.getShow30();}
		else if(!ctrlpreg.getShow31())
		{	correcto=ctrlpreg.getShow31();}
		else if(!ctrlpreg.getShow32())
		{	correcto=ctrlpreg.getShow32();}
		else if(!ctrlpreg.getShow33())
		{	correcto=ctrlpreg.getShow33();}
		return correcto;
	}

	public List<EncuestDocDTO> obtenerEncuesta(Integer usuid)
			throws DataAccessException {
		// TODO Auto-generated method stub
		return encdao.getEncuestDoc(usuid);
	}

}
